<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/6/4 0004
 * Time: 13:58
 */

namespace app\models;

use yii\base\Model;

class UploadForm extends Model
{
    public $audioFile;
    //规则
    public function rules(){
        return [
            [['audioFile'],'file','skipOnEmpty'=>false,'extensions'=>'wav,pcm']
        ];
    }
    //验证保存
    public function  upload()
    {
        if($this->validate()){
            $this->audioFile->saveAs('uploads/'.$this->audioFile->baseName.'.'. $this->imageFile->extension);
            return true;
        }else{
            return false;
        }
    }

}